import React, { Component } from 'react'

// function high(Com) {
//     return class NewCom extends Component {
//         state = {
//             count: 100,
//             num: 888
//         }
//         handlder = () => {
//             this.setState({
//                 count: this.state.count += 1
//             })
//         }
//         render() {
//             return <div className='warp'>
//                 <Com { ...this.state } handlder = { this.handlder }/>
//             </div>
//         }
//     }
// }



function high(num) {
    return (Com) => {
        return class NewCom extends Component {
            state = {
                count: 100,
                num: 888
            }
            handlder = () => {
                this.setState({
                    count: this.state.count += num
                })
            }
            render() {
                return <div className='warp'>
                    <Com { ...this.state } handlder = { this.handlder }/>
                </div>
            }
        }
    }
}

class High extends Component {
    render() {
        return (
            <div>
                <h4>高阶组件</h4>
            </div>
        )
    }
}


// High = high(High)

export {
    high
}


export default High
